<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.2">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"wrr123.github.io","root":"/","scheme":"Muse","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.json"};
  </script>

  <meta name="description" content="闲时与你立黄昏，笑问灶前粥可温。">
<meta property="og:type" content="article">
<meta property="og:title" content="doom-emacs-modules篇">
<meta property="og:url" content="https://wrr123.github.io/2021/07/05/doom-emacs-modules%E7%AF%87/index.html">
<meta property="og:site_name" content="一缕烟气">
<meta property="og:description" content="闲时与你立黄昏，笑问灶前粥可温。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://localhost:4000/2021/07/05/doom-emacs-modules%E7%AF%87/001.png">
<meta property="article:published_time" content="2021-07-05T05:35:44.000Z">
<meta property="article:modified_time" content="2022-02-18T02:52:04.384Z">
<meta property="article:author" content="田园隐士">
<meta property="article:tag" content="doom emacs">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://localhost:4000/2021/07/05/doom-emacs-modules%E7%AF%87/001.png">

<link rel="canonical" href="https://wrr123.github.io/2021/07/05/doom-emacs-modules%E7%AF%87/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>doom-emacs-modules篇 | 一缕烟气</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

<style>mjx-container[jax="SVG"] {
  direction: ltr;
}

mjx-container[jax="SVG"] > svg {
  overflow: visible;
}

mjx-container[jax="SVG"][display="true"] {
  display: block;
  text-align: center;
  margin: 1em 0;
}

mjx-container[jax="SVG"][justify="left"] {
  text-align: left;
}

mjx-container[jax="SVG"][justify="right"] {
  text-align: right;
}

g[data-mml-node="merror"] > g {
  fill: red;
  stroke: red;
}

g[data-mml-node="merror"] > rect[data-background] {
  fill: yellow;
  stroke: none;
}

g[data-mml-node="mtable"] > line[data-line] {
  stroke-width: 70px;
  fill: none;
}

g[data-mml-node="mtable"] > rect[data-frame] {
  stroke-width: 70px;
  fill: none;
}

g[data-mml-node="mtable"] > .mjx-dashed {
  stroke-dasharray: 140;
}

g[data-mml-node="mtable"] > .mjx-dotted {
  stroke-linecap: round;
  stroke-dasharray: 0,140;
}

g[data-mml-node="mtable"] > svg {
  overflow: visible;
}

[jax="SVG"] mjx-tool {
  display: inline-block;
  position: relative;
  width: 0;
  height: 0;
}

[jax="SVG"] mjx-tool > mjx-tip {
  position: absolute;
  top: 0;
  left: 0;
}

mjx-tool > mjx-tip {
  display: inline-block;
  padding: .2em;
  border: 1px solid #888;
  font-size: 70%;
  background-color: #F8F8F8;
  color: black;
  box-shadow: 2px 2px 5px #AAAAAA;
}

g[data-mml-node="maction"][data-toggle] {
  cursor: pointer;
}

mjx-status {
  display: block;
  position: fixed;
  left: 1em;
  bottom: 1em;
  min-width: 25%;
  padding: .2em .4em;
  border: 1px solid #888;
  font-size: 90%;
  background-color: #F8F8F8;
  color: black;
}

foreignObject[data-mjx-xml] {
  font-family: initial;
  line-height: normal;
  overflow: visible;
}

.MathJax path {
  stroke-width: 3;
}

mjx-container[display="true"] {
  overflow: auto hidden;
}

mjx-container[display="true"] + br {
  display: none;
}
</style><link rel="alternate" href="/atom.xml" title="一缕烟气" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">一缕烟气</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">沧海月明珠有泪，蓝田日暖玉生烟</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://wrr123.github.io/2021/07/05/doom-emacs-modules%E7%AF%87/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="田园隐士">
      <meta itemprop="description" content="talk is cheap, show me the code">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一缕烟气">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          doom-emacs-modules篇
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-07-05 13:35:44" itemprop="dateCreated datePublished" datetime="2021-07-05T13:35:44+08:00">2021-07-05</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-02-18 10:52:04" itemprop="dateModified" datetime="2022-02-18T10:52:04+08:00">2022-02-18</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/doom-emacs/" itemprop="url" rel="index"><span itemprop="name">doom emacs</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span><br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>10k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>9 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p><div style="color:Chocolate;text-align:center;display:inline-block;width:100%;">
闲时与你立黄昏，笑问灶前粥可温。
</div><br><span id="more"></span></p>
<h4 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h4><h5 id="windows下的emacs只能打开C盘下的文件，其它盘符下的文件访问不到？？"><a href="#windows下的emacs只能打开C盘下的文件，其它盘符下的文件访问不到？？" class="headerlink" title="windows下的emacs只能打开C盘下的文件，其它盘符下的文件访问不到？？"></a>windows下的emacs只能打开C盘下的文件，其它盘符下的文件访问不到？？</h5><p><img src="http://localhost:4000/2021/07/05/doom-emacs-modules%E7%AF%87/001.png" alt></p>
<h4 id="configure"><a href="#configure" class="headerlink" title="configure"></a>configure</h4><h5 id="Modules"><a href="#Modules" class="headerlink" title="Modules"></a>Modules</h5><p>Doom由160多个模块组成，并且还在增长中。一个模块就是一个包、配置、命令的组合，可以通过你的<code>doom!</code>代码块来简单切换的一个单元。</p>
<p>你的<code>doom!</code>代码块应该看起来像下面这样：<br><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">;; To comment something out, you insert at least one semicolon before it and the</span><br><span class="line">;; Emacs Lisp interpreter will ignore everything until the end of the line.</span><br><span class="line">(doom! :lang</span><br><span class="line">       python        ; this module is not commented, therefore enabled</span><br><span class="line">       ;;javascript  ; this module is commented out, therefore disabled</span><br><span class="line">       ;;lua         ; this module is disabled</span><br><span class="line">       ruby          ; this module is enabled</span><br><span class="line">       php)          ; this module is enabled</span><br></pre></td></tr></table></figure></p>
<p>它控制了什么模块被启用和什么命令被加载。一些模块有<strong>可选特点(被启用通过一些标记，指示一个+前缀)。</strong><br><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">(doom! :completion</span><br><span class="line">       (company +childframe)</span><br><span class="line">       :lang</span><br><span class="line">       (csharp +unity)</span><br><span class="line">       (org +brain +dragndrop +gnuplot +hugo +jupyter)</span><br><span class="line">       (sh +fish))</span><br></pre></td></tr></table></figure></p>
<p><strong>重要的：</strong> 任何在你的<code>doom!</code>代码块中的改变都不会立刻生效，直到你运行<code>doom sync</code>命令在你的命令行中。<br><strong>doom doctor</strong>将会通过你的<code>doom!</code>代码块检测问题，例如重复、拼写错误的模块和标记。</p>
<h5 id="包管理器"><a href="#包管理器" class="headerlink" title="包管理器"></a>包管理器</h5><p>Doom Emacs不会使用<code>package.el</code>, 代替的，它会使用它自己声明的、构建在<code>straight.el</code>顶部的包管理器。</p>
<p><strong>警告：</strong> 不要直接使用<code>M-x package-install</code>或<code>M-x straight-use-package</code>来安装包。在一些地方没有匹配的<code>package!</code>声明,这些包将会被遗忘和删除，当你重启Emacs和下次运行<code>doom sync</code>和<code>doom purge</code>命令的时候。</p>
<h6 id="安装包"><a href="#安装包" class="headerlink" title="安装包"></a>安装包</h6><p>去安装一个包，添加一个<code>package!</code>声明在<code>DOOMDIR/packges.el</code>文件中。<br><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">;; Install a package named "example" from ELPA, MELPA, or Emacsmirror</span><br><span class="line">(package! example)</span><br></pre></td></tr></table></figure></p>
<p>如果一个包在任何已知的仓库中都没有找到的话，你将会得到一个类似下面一样的错误：<br><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">Could not find package X in recipe repositories: (org-elpa melpa gnu-elpa-mirror</span><br><span class="line">emacsmirror-mirror)</span><br></pre></td></tr></table></figure></p>
<p>最大的可以引起类似错误的原因如下：</p>
<ul>
<li>你拼错了包的名字</li>
<li>或者包真的在<code>ELPA, MELPA, EmacsMirror</code>中不存在，那么你需要指明包的<code>recipe</code>。</li>
</ul>
<p><strong>直到你运行了<code>doom sync</code>命令，新包才会被安装。</strong></p>
<h6 id="从外部的资源安装包"><a href="#从外部的资源安装包" class="headerlink" title="从外部的资源安装包"></a>从外部的资源安装包</h6><p>从外部的资源，如<code>github, gitlab, etc</code>，直接安装一个包，你将需要指明一个<code>MELPA-style straight recipe</code>。</p>
<p>这里是一些例子：<br><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line">;; Install it directly from a github repository. For this to work, the package</span><br><span class="line">;; must have an appropriate PACKAGENAME.el file which must contain at least a</span><br><span class="line">;; Package-Version or Version line in its header.</span><br><span class="line">(package! example</span><br><span class="line">  :recipe (:host github :repo "username/my-example-fork"))</span><br><span class="line"></span><br><span class="line">;; If the source files for a package are in a subdirectory in said repo, use</span><br><span class="line">;; `:files' to target them.</span><br><span class="line">(package! example :recipe</span><br><span class="line">  (:host github</span><br><span class="line">   :repo "username/my-example-fork"</span><br><span class="line">   :files ("*.el" "src/lisp/*.el")))</span><br><span class="line"></span><br><span class="line">;; To grab a particular branch or tag:</span><br><span class="line">(package! example :recipe</span><br><span class="line">  (:host gitlab</span><br><span class="line">   :repo "username/my-example-fork"</span><br><span class="line">   :branch "develop"))</span><br><span class="line"></span><br><span class="line">;; If a package has a default recipe on MELPA or emacsmirror, you may omit</span><br><span class="line">;; keywords and the recipe will inherit the rest of the recipe from their</span><br><span class="line">;; original.</span><br><span class="line">(package! example :recipe (:branch "develop"))</span><br><span class="line"></span><br><span class="line">;; If the repo pulls in many unneeded submodules, you can disable recursive cloning</span><br><span class="line">(package! example :recipe (:nonrecursive t))</span><br><span class="line"></span><br><span class="line">;; A package can be installed straight from a git repo by setting :host to nil:</span><br><span class="line">(package! example</span><br><span class="line">  :recipe (:host nil :repo "https://some/git/repo"))</span><br></pre></td></tr></table></figure></p>
<p><strong>无论何时你改变了<code>package.el</code>文件都要去运行<code>~bin/doom sync</code>来确保你的改变起作用。</strong></p>
<h6 id="固定安装包到指定的commits"><a href="#固定安装包到指定的commits" class="headerlink" title="固定安装包到指定的commits"></a>固定安装包到指定的commits</h6><p>所有Doom的包都是被默认的固定的。一个包被锁到一个指定的commit，像这样:<br><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">(package! evil :pin "e00626d9fd")</span><br></pre></td></tr></table></figure></p>
<p>将一个包取消固定，使用宏命令<code>unpin!</code>:<br><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">(unpin! evil)</span><br><span class="line"></span><br><span class="line">;; It can be used to unpin multiple packages at once</span><br><span class="line">(unpin! evil helm org-mode)</span><br><span class="line"></span><br><span class="line">;; Or to unpin all packages in modules</span><br><span class="line">(unpin! (:lang python ruby rust) (:tools docker))</span><br><span class="line"></span><br><span class="line">;; Or to unpin an entire category of modules</span><br><span class="line">(unpin! :completion :lang :tools)</span><br><span class="line"></span><br><span class="line">;; This will work too, if you prefer the syntax, but it provides no concise</span><br><span class="line">;; syntax for unpinning multiple packages:</span><br><span class="line">(package! helm :pin nil)</span><br></pre></td></tr></table></figure></p>
<h6 id="使包不可用"><a href="#使包不可用" class="headerlink" title="使包不可用"></a>使包不可用</h6><p><code>package!</code>宏命令拥有一个<code>:disable</code>属性。如下所示：<br><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">(package! irony :disable t)</span><br><span class="line">(package! rtags :disable t)</span><br></pre></td></tr></table></figure></p>
<p>当一个包是不可用的状态时，<code>use-package!</code>和<code>after!</code>代码块将会被忽略掉，并且当你下次运行<code>~bin/doom sync</code>命令的时候，这个包将会被删除。</p>
<p>现在也有一个宏命令<code>disable-packages!</code>来非常方便的使多个包不可用。<br><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">(disable-packages! irony rtags)</span><br></pre></td></tr></table></figure></p>
<h6 id="为一个已包含的包改变地址"><a href="#为一个已包含的包改变地址" class="headerlink" title="为一个已包含的包改变地址"></a>为一个已包含的包改变地址</h6><p>如果Doom模块从一个地方安装了包<code>X</code>,但是你想要从另一个地方安装它，添加一个<code>package!</code>声明到你的配置文件<code>DOOMDIR/packages.el</code>中。你私人的声明总是拥有相对于模块的优先权。</p>
<p>一个例子：<br><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">(package! evil) ; installs from MELPA</span><br><span class="line"></span><br><span class="line">;; in DOOMDIR/packages.el</span><br><span class="line">(package! evil :recipe (:host github :repo "username/my-evil-fork"))</span><br></pre></td></tr></table></figure></p>
<p>安装一个包仅当<code>built-in</code>包不存在的时候，使用<code>:built-in 'prefer</code><br><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">(package! so-long :built-in 'prefer)</span><br></pre></td></tr></table></figure></p>
<p><strong>记得运行<code>doom sync -u</code>当改变存在的包的路径地址之后。在写的同时，<code>doom sync</code>将不会单独的加载在包路径地址的改变。</strong></p>
<h6 id="使用和加载本地的包"><a href="#使用和加载本地的包" class="headerlink" title="使用和加载本地的包"></a>使用和加载本地的包</h6><p>假设你正在本地开发一个Emacs的包，并且想要安装它来进行本地测试。去指定一个<code>:local-repo</code>在包的路径地址上：<br><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">(package! my-package</span><br><span class="line">  :recipe (:local-repo "/path/to/my/package"))</span><br><span class="line"></span><br><span class="line">;; Relative paths are expanded to ~/.emacs.d/.local/straight/repos/{local-repo}</span><br><span class="line">;; or ~/.doom.d/{local-repo} -- the first that is found.</span><br><span class="line">(package! my-package</span><br><span class="line">  :recipe (:local-repo "my/package"))  ; looks for ~/.doom.d/my/package/my-package.el</span><br><span class="line"></span><br><span class="line">(package! my-package</span><br><span class="line">  :recipe (:local-repo "/path/to/my/package"</span><br><span class="line"></span><br><span class="line">           ;; By default, the package manager grabs all *.el files at the root</span><br><span class="line">           ;; of the project and nothing else. To include other files, or</span><br><span class="line">           ;; accommodate unconventional project structures, specify what :files</span><br><span class="line">           ;; you want:</span><br><span class="line">           :files ("*.el" "src/lisp/*.el")</span><br><span class="line"></span><br><span class="line">           ;; With this you can avoid having to run 'doom sync' every time you</span><br><span class="line">           ;; change the package.</span><br><span class="line">           :build (:not compile)))</span><br></pre></td></tr></table></figure></p>
<p>另外，加入包的位置路径到Emacs的<code>load-path</code>.如果你不需要或者不关心自动加载cookies和字节编译的话，可以这样做。<br><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">;; Doom has modified `use-package's `:load-path' to expand relative paths from</span><br><span class="line">;; your DOOMDIR. e.g. ~/.doom.d/lisp/package</span><br><span class="line">(use-package my-package</span><br><span class="line">  :load-path "lisp/package")</span><br><span class="line"></span><br><span class="line">;; or</span><br><span class="line"></span><br><span class="line">(add-load-path! "lisp/package")</span><br></pre></td></tr></table></figure></p>
<h5 id="配置Doom"><a href="#配置Doom" class="headerlink" title="配置Doom"></a>配置Doom</h5><h6 id="配置包"><a href="#配置包" class="headerlink" title="配置包"></a>配置包</h6><p>如果你的配置需求是简单的，那么<code>use-packag!, after!, add-hook!, setq_hook!</code>这几个宏命令是你的最爱。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line">;;; ~/.doom.d/config.el (example)</span><br><span class="line">(setq doom-font (font-spec :family "Fira Mono" :size 12))</span><br><span class="line"></span><br><span class="line">;; Takes a feature symbol or a library name (string)</span><br><span class="line">(after! evil</span><br><span class="line">  (setq evil-magic nil))</span><br><span class="line"></span><br><span class="line">;; Takes a major-mode, a quoted hook function or a list of either</span><br><span class="line">(add-hook! python-mode</span><br><span class="line">  (setq python-shell-interpreter "bpython"))</span><br><span class="line"></span><br><span class="line">;; These are equivalent</span><br><span class="line">(setq-hook! 'python-mode-hook python-indent-offset 2)</span><br><span class="line">(setq-hook! python-mode python-indent-offset 2)</span><br><span class="line"></span><br><span class="line">(use-package! hl-todo</span><br><span class="line">  ;; if you omit :defer, :hook, :commands, or :after, then the package is loaded</span><br><span class="line">  ;; immediately. By using :hook here, the `hl-todo` package won't be loaded</span><br><span class="line">  ;; until prog-mode-hook is triggered (by activating a major mode derived from</span><br><span class="line">  ;; it, e.g. python-mode)</span><br><span class="line">  :hook (prog-mode . hl-todo-mode)</span><br><span class="line">  :init</span><br><span class="line">  ;; code here will run immediately</span><br><span class="line">  :config</span><br><span class="line">  ;; code here will run after the package is loaded</span><br><span class="line">  (setq hl-todo-highlight-punctuation ":"))</span><br></pre></td></tr></table></figure>
<p>为了更多的灵活性，<code>use-package-hook!</code>是另一个选项，但是应该当作最后一个考虑（因为通常有更好的方法）。它允许你<code>disable, append, prepend</code>，去覆盖Doom的<code>use-package!</code>代码块。</p>
<p><strong><code>use-package-hook!</code>必须在包的<code>use-package!</code>代码块之前使用。因此，它必须在你的私人的<code>init.el</code>文件中使用。</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">;;; ~/.doom.d/init.el (example)</span><br><span class="line">;; If a :pre-init / :pre-config hook returns nil, it overwrites that package's</span><br><span class="line">;; original :init / :config block. Exploit this to overwrite Doom's config.</span><br><span class="line">(use-package-hook! doom-themes</span><br><span class="line">  :pre-config</span><br><span class="line">  (setq doom-neotree-file-icons t)</span><br><span class="line">  nil)</span><br><span class="line"></span><br><span class="line">;; ...otherwise, make sure they always return non-nil!</span><br><span class="line">(use-package-hook! evil</span><br><span class="line">  :pre-init</span><br><span class="line">  (setq evil-magic nil)</span><br><span class="line">  t)</span><br><span class="line"></span><br><span class="line">;; `use-package-hook' also has :post-init and :post-config hooks</span><br></pre></td></tr></table></figure>
<h6 id="重新加载你的配置"><a href="#重新加载你的配置" class="headerlink" title="重新加载你的配置"></a>重新加载你的配置</h6><p>你会发现它是非常有用的，使你的改变立刻生效。一些使用如改变了包的可用性或者安装一个包，不要求完全重新启动Doom Emacs，你可以在<code>on-the-fly</code>上计算Emacs Lisp代码的值。</p>
<ul>
<li><p>Evil用户可以使用<code>gr</code>操作来求代码片段的值。返回值会在minibuffer或者弹出框中展示。</p>
</li>
<li><p>Non-evil用户可以使用<code>C-x C-e</code>来运行<code>eval-last-sexp</code>,和运行<code>M-x eval/buffer-or-region（SPC c e）</code>是一样的。</p>
</li>
<li><p>另一个选项是使用<code>SPC x</code>打开一个草稿缓存，改变它的主模式(<code>M-x emacs-lisp-mode</code>),然后使用上面的keys来计算你的代码的值。</p>
</li>
<li><p>一个<code>ielm REPL</code>是可用的通过点击<code>SPC o r</code>（+eval/open-repl=other-window）。</p>
</li>
<li><p>这里还有<code>M-:</code> 和 <code>SPC ;</code>命令来调用<code>eval-expression</code>，你可以使用它来运行elisp代码。</p>
<h6 id="绑定快捷键"><a href="#绑定快捷键" class="headerlink" title="绑定快捷键"></a>绑定快捷键</h6></li>
<li><p>define-key</p>
</li>
<li>global-set-key</li>
<li>map!</li>
<li>undefine-key!</li>
<li>define-key!</li>
</ul>
<h5 id="写你自己的模块"><a href="#写你自己的模块" class="headerlink" title="写你自己的模块"></a>写你自己的模块</h5><p>创建自己的模块你只要创建一个目录，类似这样<code>~/.doom.d/modules/abc/xyz</code>,然后添加<code>:abc xyz</code>到你的文件<code>~/.doom.d/init.el</code>的<code>doom!</code>代码块来激活它。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">在上面的例子中，`:abc`被叫做目录，`xyz`是模块的名字。</span><br><span class="line">Doom 指向模块是使用的这两种格式中的一种`:abc xyz`, `abc/xyz`</span><br></pre></td></tr></table></figure>
<p>如果一个私有的模块拥有和Doom自带的模块相同的名字，如<code>:lang org</code>,那么私有模块会取代Doom自带的模块。用这种方式你可以覆盖掉你不喜欢的模块。</p>
<ul>
<li><code>package.el</code>去声明所有Doom将会安装的包。</li>
<li><code>config.el</code>去配置和加载这些包。</li>
<li><code>autoload.el</code>有时会去储存模块使用时被加载的函数。</li>
</ul>
<h6 id="文件结构"><a href="#文件结构" class="headerlink" title="文件结构"></a>文件结构</h6><p>Doom 可以识别少量的特殊的文件名称，对一个模块来说，没有一个文件是必须的.</p>
<p>这些文件是：<br><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">category/</span><br><span class="line">  module/</span><br><span class="line">    test/*.el</span><br><span class="line">    autoload/*.el</span><br><span class="line">    autoload.el</span><br><span class="line">    init.el</span><br><span class="line">    cli.el</span><br><span class="line">    config.el</span><br><span class="line">    packages.el</span><br><span class="line">    doctor.el</span><br></pre></td></tr></table></figure></p>
<ul>
<li><p><code>init.el</code></p>
<p>这个文件会很早的被加载，在任何其它的文件之前，但是是在Doom的核心包加载之后。<br>它被加载在交互和非交互的session(它是唯一的一个文件，包括<code>cli.el</code>在内，当<code>bin/doom</code>启动的时候被加载)里。</p>
<p>可以做的：</p>
<ul>
<li>配置Emacs或者运行安装和卸载操作时，必须被很早的设置；</li>
<li>使用<code>use-package-hook!</code>来重新配置在Doom模块中定义的包；<br>作为最后的帮助步骤，当<code>after!</code>和<code>hooks</code>不够使用的时候。</li>
<li>配置<code>bin/doom</code>的行为，以一种方式，必须在交互的命令行中运用。</li>
</ul>
<p>不可以做的：</p>
<ul>
<li>从这里使用<code>use-package!</code>或<code>after!</code>来配置包；</li>
<li>…</li>
</ul>
</li>
<li><p>config.el<br>每一个模块的心脏部分。在这个文件里的代码需要已经在<code>package.el</code>安装了依赖并且是可以使用的。使用这个文件来加载和配置它的包。</p>
<p>可以做的：</p>
<ul>
<li>使用<code>after!</code>或<code>use-package!</code>去配置包。<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">;; 文件位置：modules/completion/company/config.el</span><br><span class="line">(use-package! company</span><br><span class="line">  :commands (company-mode global-company-mode)  </span><br><span class="line">  :config</span><br><span class="line">  (setq company-idle-delay nil)</span><br><span class="line">  )</span><br></pre></td></tr></table></figure></li>
<li>使用<code>use-package</code>的<code>:defer</code>属性来懒加载包</li>
<li>使用<code>featurep!</code>宏来做一些可选的配置基于另一个模块的状态或者一个标记的有无。</li>
</ul>
<p>不可以做的：</p>
<ul>
<li>使用<code>package!</code></li>
<li>使用<code>package.el</code>或者<code>use-package</code>的<code>:ensure</code>属性来安装包。Doom拥有它自己的包管理器。那是<code>package.el</code>需要做的事情。</li>
</ul>
</li>
</ul>
<ul>
<li><p><code>packages.el</code></p>
<p>这个文件是包声明存放的位置。它也是一个很好的地方去查找你想要看的一个模块拥有哪些包，和这个模块是从哪些安装的。</p>
<p>可以做的：</p>
<ul>
<li>使用<code>package!</code>宏来声明包</li>
<li>禁用一个包,使用<code>package!</code>的<code>:disable</code>属性；使用<code>disable-packages!</code>来禁用多个包</li>
<li>使用<code>featurep!</code>宏来做一些可选的配置基于另一个模块的状态或者一个标记的有无。</li>
</ul>
</li>
</ul>
<h6 id="标记"><a href="#标记" class="headerlink" title="标记"></a>标记</h6><p>一个模块的标记是一个任意的语法.传统来说，这些语法是使用<code>+</code>,<code>-</code>前缀来指示添加还是删除一个特征的，各自的，没有多功能的标记对这个标记来说。</p>
<p>一个模块可以选择去解释标记，不管它想不想，并且可以使用<code>featurep!</code>宏来进行测试。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">;; 检查当前模块是否启用的时候，含有+my-feature标记</span><br><span class="line">(when (featurep! +my-feature) ...)</span><br><span class="line"></span><br><span class="line">;; 它也能在检查其它模块中的标记是否存在</span><br><span class="line">(when (featurep! :lang python +lsp) ...)</span><br></pre></td></tr></table></figure>
<h6 id="Doom-cookies"><a href="#Doom-cookies" class="headerlink" title="Doom cookies"></a>Doom cookies</h6><p>自动加载cookies很早就被提到了。<br>这个章节将要回顾下他们做什么以及如何去使用他们。</p>
<h3 id="Frequently-Asked-Questions"><a href="#Frequently-Asked-Questions" class="headerlink" title="Frequently Asked Questions"></a>Frequently Asked Questions</h3><h4 id="常见配置问题"><a href="#常见配置问题" class="headerlink" title="常见配置问题"></a>常见配置问题</h4><h5 id="如何去配置Doom-Emacs"><a href="#如何去配置Doom-Emacs" class="headerlink" title="如何去配置Doom Emacs"></a>如何去配置Doom Emacs</h5><p>标准来说，你的私人配置应该放在目录<code>~/.doom.d/</code>或者<code>~/.config/doom/</code>下.</p>
<p>这个目录关系到你的<code>DOOMDIR</code>环境变量。</p>
<p>你的私人配置通常由<code>init.el</code>, <code>config.el</code>和<code>package.el</code>文件组成。将你的所有配置放在<code>config.el</code>文件下，通过添加<code>package!</code>声明到<code>package.el</code>文件中来安装包，启用、禁用模块在你的<code>doom!</code>代码块，当你第一次运行<code>doom install</code>命令时，在你的<code>init.el</code>文件中创建该代码块。</p>
<p>你不应该去fork Doom或者修改<code>~/.emacs.d</code>文件夹。如果你必须这样做去实现某些事情，这会被认为是一个BUG。</p>
<h5 id="如何去改变主题"><a href="#如何去改变主题" class="headerlink" title="如何去改变主题"></a>如何去改变主题</h5><p>有两种方式去加载主题。全都假设主题已经被安装了并且是可用的。你既可以设置<code>doom-theme</code>也可以手动通过<code>load-theme</code>函数来加载一个主题。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">;;; 加入到`~/.doom.d/config.el`文件中</span><br><span class="line">(setq doom-theme 'doom-tomorrow-night)</span><br><span class="line">;; 或者</span><br><span class="line">(load-theme 'doom-tomorrow-night t)</span><br></pre></td></tr></table></figure>
<blockquote>
<p>此刻，两种方式唯一的不同就是<code>doom-theme</code>是在Emacs启动完成初始化时开始加载，而<code>load-theme</code>会立刻加载主题。选择哪个依赖于你的需要，但是我建议设置<code>doom-theme</code>, 因为如果我以后发现了一个更好的方式去加载主题，我能简单的改变Doom如何使用的<code>doom-theme</code>,但是我不能简单的控制你如何使用的<code>load-theme</code>函数。</p>
</blockquote>
<h6 id="安装第三方的主题"><a href="#安装第三方的主题" class="headerlink" title="安装第三方的主题"></a>安装第三方的主题</h6><p>从第三方的插件库安装主题，比如，<code>solarized</code>，你仅仅需要安装它，然后加载它。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">;;; add to `~/.doom.d/packages.el`</span><br><span class="line">(package! solarized-theme)</span><br><span class="line">;; add to ~/.doom.d/config.el</span><br><span class="line">(setq doom-theme 'solarized-dark)</span><br></pre></td></tr></table></figure>
<p>为了确保包已经被安装，添加了<code>package!</code>语句之后，不要忘记去运行<code>doom sync</code>。</p>
<h5 id="如何去改变字体"><a href="#如何去改变字体" class="headerlink" title="如何去改变字体"></a>如何去改变字体</h5><p>Doom 暴露出了5个可选的参数去控制字体，它们分别是：</p>
<ul>
<li><code>doom-font</code></li>
<li><code>doom-variable-pitch-font</code></li>
<li><code>doom-serif-font</code></li>
<li><code>doom-unicode-font</code> (一个回滚字体为了你的默认字体不支持的统一码语法)</li>
<li><code>doom-big-font</code> (为了<code>doom-big-font-mode</code>模式而使用的)</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">;;; Add to ~/.doom.d/config.el</span><br><span class="line">(setq doom-font (font-spec :family "Input Mono Narrow" :size 12 :weight 'semi-light)</span><br><span class="line">      doom-variable-pitch-font (font-spec :family "Fira Sans") ; inherits `doom-font''s :size</span><br><span class="line">      doom-unicode-font (font-spec :family "Input Mono Narrow" :size 12)</span><br><span class="line">      doom-big-font (font-spec :family "Fira Mono" :size 19))</span><br></pre></td></tr></table></figure>
<h5 id="如何绑定我自己的按键或者改变已经存在的"><a href="#如何绑定我自己的按键或者改变已经存在的" class="headerlink" title="如何绑定我自己的按键或者改变已经存在的"></a>如何绑定我自己的按键或者改变已经存在的</h5><p>有很多的方式。Emacs提供了许多按键绑定的函数：</p>
<ul>
<li><code>define-key KEYMAP KEY DEF</code></li>
<li><code>global-set-key KEY DEF</code></li>
<li><code>local-set-key KEY DEF</code></li>
<li><code>evil-define-key STATE KEYMAP KEY DEF &amp;rest ...</code></li>
</ul>
<p>然而，Doom提供了一个<code>map!</code>宏，它可以方便的将上面的四个函数包装成一个更加简洁的语法。详尽的<code>map!</code>的使用样例可以在这个文档(通过<code>SPC h f map\!</code>或者<code>C-h f map\!</code>)下被找到。</p>
<p>也有一些<code>map!</code>的使用样例在文件<code>config/default/+evil-bindings.el</code>中。</p>
<h5 id="如何去改变leader-localleader的绑定键"><a href="#如何去改变leader-localleader的绑定键" class="headerlink" title="如何去改变leader/localleader的绑定键"></a>如何去改变leader/localleader的绑定键</h5><ul>
<li>对Evil用户：<ul>
<li><code>doom-leader-key</code> (默认的是<code>SPC</code>)</li>
<li><code>doom-localleader-key</code> (默认的<code>SPC m</code>)</li>
</ul>
</li>
<li>对Emacs和Evil用户的插入模式，以及非Evil用户<ul>
<li><code>doom-leader-alt-key</code> (默认的，<code>M-SPC</code>对Evil用户，<code>C-c</code>对其它的用户)</li>
<li><code>doom-localleader-al-key</code> (默认的，<code>M-SPC m</code>对Evil用户, <code>C-c l</code>对其它的用户)</li>
</ul>
</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">;;; add to ~/.doom.d/config.el</span><br><span class="line">(setq doom-leader-key ","</span><br><span class="line">      doom-localleader-key "\\")</span><br></pre></td></tr></table></figure>

    </div>

    
    
    
        

  <div class="followme">
    <p>欢迎关注我的其它发布渠道</p>

    <div class="social-list">

        <div class="social-item">
          <a target="_blank" class="social-link" href="/atom.xml">
            <span class="icon">
              <i class="fa fa-rss"></i>
            </span>

            <span class="label">RSS</span>
          </a>
        </div>
    </div>
  </div>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/doom-emacs/" rel="tag"># doom emacs</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2021/06/28/emacs-gtd/" rel="prev" title="emacs-gtd">
      <i class="fa fa-chevron-left"></i> emacs-gtd
    </a></div>
      <div class="post-nav-item">
    <a href="/2021/07/08/doom-emacs%E6%8F%92%E4%BB%B6%E8%87%AA%E5%AE%9A%E4%B9%89%E7%AF%87/" rel="next" title="doom-emacs插件自定义篇">
      doom-emacs插件自定义篇 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-4"><a class="nav-link" href="#FAQ"><span class="nav-number">1.</span> <span class="nav-text">FAQ</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#windows%E4%B8%8B%E7%9A%84emacs%E5%8F%AA%E8%83%BD%E6%89%93%E5%BC%80C%E7%9B%98%E4%B8%8B%E7%9A%84%E6%96%87%E4%BB%B6%EF%BC%8C%E5%85%B6%E5%AE%83%E7%9B%98%E7%AC%A6%E4%B8%8B%E7%9A%84%E6%96%87%E4%BB%B6%E8%AE%BF%E9%97%AE%E4%B8%8D%E5%88%B0%EF%BC%9F%EF%BC%9F"><span class="nav-number">1.1.</span> <span class="nav-text">windows下的emacs只能打开C盘下的文件，其它盘符下的文件访问不到？？</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#configure"><span class="nav-number">2.</span> <span class="nav-text">configure</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#Modules"><span class="nav-number">2.1.</span> <span class="nav-text">Modules</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%8C%85%E7%AE%A1%E7%90%86%E5%99%A8"><span class="nav-number">2.2.</span> <span class="nav-text">包管理器</span></a><ol class="nav-child"><li class="nav-item nav-level-6"><a class="nav-link" href="#%E5%AE%89%E8%A3%85%E5%8C%85"><span class="nav-number">2.2.1.</span> <span class="nav-text">安装包</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#%E4%BB%8E%E5%A4%96%E9%83%A8%E7%9A%84%E8%B5%84%E6%BA%90%E5%AE%89%E8%A3%85%E5%8C%85"><span class="nav-number">2.2.2.</span> <span class="nav-text">从外部的资源安装包</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#%E5%9B%BA%E5%AE%9A%E5%AE%89%E8%A3%85%E5%8C%85%E5%88%B0%E6%8C%87%E5%AE%9A%E7%9A%84commits"><span class="nav-number">2.2.3.</span> <span class="nav-text">固定安装包到指定的commits</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#%E4%BD%BF%E5%8C%85%E4%B8%8D%E5%8F%AF%E7%94%A8"><span class="nav-number">2.2.4.</span> <span class="nav-text">使包不可用</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#%E4%B8%BA%E4%B8%80%E4%B8%AA%E5%B7%B2%E5%8C%85%E5%90%AB%E7%9A%84%E5%8C%85%E6%94%B9%E5%8F%98%E5%9C%B0%E5%9D%80"><span class="nav-number">2.2.5.</span> <span class="nav-text">为一个已包含的包改变地址</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#%E4%BD%BF%E7%94%A8%E5%92%8C%E5%8A%A0%E8%BD%BD%E6%9C%AC%E5%9C%B0%E7%9A%84%E5%8C%85"><span class="nav-number">2.2.6.</span> <span class="nav-text">使用和加载本地的包</span></a></li></ol></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E9%85%8D%E7%BD%AEDoom"><span class="nav-number">2.3.</span> <span class="nav-text">配置Doom</span></a><ol class="nav-child"><li class="nav-item nav-level-6"><a class="nav-link" href="#%E9%85%8D%E7%BD%AE%E5%8C%85"><span class="nav-number">2.3.1.</span> <span class="nav-text">配置包</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#%E9%87%8D%E6%96%B0%E5%8A%A0%E8%BD%BD%E4%BD%A0%E7%9A%84%E9%85%8D%E7%BD%AE"><span class="nav-number">2.3.2.</span> <span class="nav-text">重新加载你的配置</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#%E7%BB%91%E5%AE%9A%E5%BF%AB%E6%8D%B7%E9%94%AE"><span class="nav-number">2.3.3.</span> <span class="nav-text">绑定快捷键</span></a></li></ol></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%86%99%E4%BD%A0%E8%87%AA%E5%B7%B1%E7%9A%84%E6%A8%A1%E5%9D%97"><span class="nav-number">2.4.</span> <span class="nav-text">写你自己的模块</span></a><ol class="nav-child"><li class="nav-item nav-level-6"><a class="nav-link" href="#%E6%96%87%E4%BB%B6%E7%BB%93%E6%9E%84"><span class="nav-number">2.4.1.</span> <span class="nav-text">文件结构</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#%E6%A0%87%E8%AE%B0"><span class="nav-number">2.4.2.</span> <span class="nav-text">标记</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#Doom-cookies"><span class="nav-number">2.4.3.</span> <span class="nav-text">Doom cookies</span></a></li></ol></li></ol></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Frequently-Asked-Questions"><span class="nav-number"></span> <span class="nav-text">Frequently Asked Questions</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%B8%B8%E8%A7%81%E9%85%8D%E7%BD%AE%E9%97%AE%E9%A2%98"><span class="nav-number">1.</span> <span class="nav-text">常见配置问题</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%A6%82%E4%BD%95%E5%8E%BB%E9%85%8D%E7%BD%AEDoom-Emacs"><span class="nav-number">1.1.</span> <span class="nav-text">如何去配置Doom Emacs</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%A6%82%E4%BD%95%E5%8E%BB%E6%94%B9%E5%8F%98%E4%B8%BB%E9%A2%98"><span class="nav-number">1.2.</span> <span class="nav-text">如何去改变主题</span></a><ol class="nav-child"><li class="nav-item nav-level-6"><a class="nav-link" href="#%E5%AE%89%E8%A3%85%E7%AC%AC%E4%B8%89%E6%96%B9%E7%9A%84%E4%B8%BB%E9%A2%98"><span class="nav-number">1.2.1.</span> <span class="nav-text">安装第三方的主题</span></a></li></ol></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%A6%82%E4%BD%95%E5%8E%BB%E6%94%B9%E5%8F%98%E5%AD%97%E4%BD%93"><span class="nav-number">1.3.</span> <span class="nav-text">如何去改变字体</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%A6%82%E4%BD%95%E7%BB%91%E5%AE%9A%E6%88%91%E8%87%AA%E5%B7%B1%E7%9A%84%E6%8C%89%E9%94%AE%E6%88%96%E8%80%85%E6%94%B9%E5%8F%98%E5%B7%B2%E7%BB%8F%E5%AD%98%E5%9C%A8%E7%9A%84"><span class="nav-number">1.4.</span> <span class="nav-text">如何绑定我自己的按键或者改变已经存在的</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%A6%82%E4%BD%95%E5%8E%BB%E6%94%B9%E5%8F%98leader-localleader%E7%9A%84%E7%BB%91%E5%AE%9A%E9%94%AE"><span class="nav-number">1.5.</span> <span class="nav-text">如何去改变leader&#x2F;localleader的绑定键</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">田园隐士</p>
  <div class="site-description" itemprop="description">talk is cheap, show me the code</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">347</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
        <span class="site-state-item-count">53</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
        <span class="site-state-item-count">115</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">田园隐士</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
    <span title="站点总字数">587k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">8:53</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://muse.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  
      

<script>
  if (typeof MathJax === 'undefined') {
    window.MathJax = {
      loader: {
          load: ['[tex]/mhchem'],
        source: {
          '[tex]/amsCd': '[tex]/amscd',
          '[tex]/AMScd': '[tex]/amscd'
        }
      },
      tex: {
        inlineMath: {'[+]': [['$', '$']]},
          packages: {'[+]': ['mhchem']},
        tags: 'ams'
      },
      options: {
        renderActions: {
          findScript: [10, doc => {
            document.querySelectorAll('script[type^="math/tex"]').forEach(node => {
              const display = !!node.type.match(/; *mode=display/);
              const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
              const text = document.createTextNode('');
              node.parentNode.replaceChild(text, node);
              math.start = {node: text, delim: '', n: 0};
              math.end = {node: text, delim: '', n: 0};
              doc.math.push(math);
            });
          }, '', false],
          insertedScript: [200, () => {
            document.querySelectorAll('mjx-container').forEach(node => {
              let target = node.parentNode;
              if (target.nodeName.toLowerCase() === 'li') {
                target.parentNode.classList.add('has-jax');
              }
            });
          }, '', false]
        }
      }
    };
    (function () {
      var script = document.createElement('script');
      script.src = '//cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js';
      script.defer = true;
      document.head.appendChild(script);
    })();
  } else {
    MathJax.startup.document.state(0);
    MathJax.texReset();
    MathJax.typeset();
  }
</script>

    

  

</body>
</html>
